{extend name="$base_mall" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="WAP_CSS/member_balance.css">
{/block}
{block name="main"}
{php}
$member_account = api("System.Member.memberAccount");
$member_account = $member_account['data'];
$sum =  $member_account['balance'];

// 提现设置
$withdraw_config = api("System.Config.balanceWithdraw");
$withdraw_config = $withdraw_config['data'];
{/php}
<div class="member-balance">
	<div id="mescroll" class="mescroll" style="top: 44px;">
		<div class="account-box ns-border-color radius-wrapper">
			<p class="balance">{$sum}</p>
			<p class="style">{:lang('member_balance')}</p>
			<a style="display: none" href="{:__URL('MALL_MAIN/member/recharge')}" class="account-title ns-border-color ns-bg-color">{:lang('recharge')}</a>
			<a style="display: none"  href="{:__URL('MALL_MAIN/member/transfer')}" class="account-title ns-border-color ns-bg-color">{:lang('transfer')}</a>
			{eq name="$withdraw_config['is_use']" value="1"}
			<div class="account-option">
				<div>
					<li class="account-option-left ns-border-color"><a href="{:__URL('MALL_MAIN/member/withdrawal')}">{:lang('member_cash_register')}</a></li>
					<li class="account-option-right ns-border-color"><a href="{:__URL('MALL_MAIN/member/applywithdrawal')}">{:lang('member_balance_withdrawal')}</a></li>
				</div>
			</div>
			{/eq}
		</div>
		<ul class="list-content radius-wrapper">
		</ul>
	</div>
</div>
{/block}
{block name="footer"}{/block}

{block name="script"}
<script type="text/javascript">
	$(function(){
		mescroll = new ScrollList("mescroll", query_detail);
	});

	function query_detail(page_index, is_append)
	{
		var params = {page_index: page_index,account_type:2};
		var html = "";
		api("System.Member.accountRecordsList", params, function (res) {
			console.log(res)
			var list = res.data;
			if (list.data.length > 0) {
				$(list.data).each(function (i, v) {
					if(!v.text){
						v.text = '调整'
					}
					html += '<div class="list-content-wrapper" style="position: relative">';
					html += '<div class="list-content-wrapper-top">';
					html += '<div class="list-content-wrapper-top-left text16">' + v.text + '</div>';
					html += '</div>';
					html += '<div class="list-content-wrapper-bottom">';
					html += '<div class="list-content-wrapper-bottom-left ns-text-color-gray">' + timeStampTurnTime(v.create_time) + '</div>';
					html += '</div>';
					html += '<div class="list-content-wrapper-top-right ns-text-color" style="position: absolute;right: 20px;top: 20px;font-size: 20px" >' + v.number + '</div>';
					html += '</div>';
					html += '<div class="line"></div>';
				});
			} else {
				html += '<div class="list-empty-wrapper">';
				html += '<div>';
					html += '<div class="list-empty-img">';
						html += '<img src="' + WAPIMG + '/wap_nodata.png">';
					html += '</div>';
					html += '<div class="list-empty-text">';
						html += '暂无数据';
					html += '</div>';
				html += '</div>';
				html += '</div>';
			}

			if (is_append) $("#mescroll ul").append(html);
			else $("#mescroll ul").html(html);
			mescroll.endByPage(list.total_count, list.page_count);
		});
	}
</script>
{/block}